package com.coincalf.admin.entity;

import com.baomidou.mybatisplus.enums.IdType;
import java.math.BigDecimal;
import java.util.Date;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableName;
import java.io.Serializable;

import com.baomidou.mybatisplus.annotations.Version;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 * 开仓订单信息
 * </p>
 *
 * @author qiang
 * @since 2018-05-13
 */
@Data
@Accessors(chain = true)
@TableName("forex_open_position_order")
public class ForexOpenPositionOrder extends Model<ForexOpenPositionOrder> {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @JsonSerialize(using = ToStringSerializer.class)
    @TableId(value = "id", type = IdType.ID_WORKER)
    private Long id;
    /**
     * 用户ID
     */
    @TableField("user_id")
    private Long userId;
    /**
     * 交易对ID
     */
    @TableField("market_id")
    private Long marketId;
    /**
     * 交易对名称
     */
    @TableField("market_name")
    private String marketName;
    /**
     * 结算币种
     */
    @TableField("coin_id")
    private Long coinId;
    /**
     * 持仓方向：1-买；2-卖
     */
    private Integer type;
    /**
     * 资金账户ID
     */
    @TableField("account_id")
    private Long accountId;
    /**
     * 委托订单
     */
    @TableField("entrust_order_id")
    private Long entrustOrderId;
    /**
     * 成交订单号
     */
    @TableField("order_id")
    private Long orderId;
    /**
     * 成交价格
     */
    private BigDecimal price;
    /**
     * 成交数量
     */
    private BigDecimal num;
    /**
     * 扣除保证金
     */
    @TableField("lock_margin")
    private BigDecimal lockMargin;
    /**
     * 平仓量
     */
    @TableField("close_num")
    private BigDecimal closeNum;
    /**
     * 状态：1：未平仓；2-已平仓
     */
    private Integer status;
    /**
     * 修改时间
     */
    @TableField("last_update_time")
    private Date lastUpdateTime;
    /**
     * 创建时间
     */
    private Date created;


    @Override
    protected Serializable pkVal() {
        return this.id;
    }

}
